package com.compty.paint.domain;

import java.util.ArrayList;
import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;

/**
 * @Todo:国家信息
 * @author: zhuqh
 * @CreateTime:2011-5-31 下午06:21:33
 */
@Entity
@Table(name = "t_countryinfo")
@Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
public class CountryInfo implements java.io.Serializable{
	
	private static final long serialVersionUID = -7962978051241953865L;

	private Long id;
	
	/************ 国家名称 ****************/
	private String name;
	
	private List<ProvinceInfo> provinces = new ArrayList<ProvinceInfo>(0);
	
	@Id
	@GeneratedValue
	@Column(name = "id", unique = true, nullable = false)
	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	@Column(name = "name", length = 40,nullable=false)
	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "countryInfo")
	public List<ProvinceInfo> getProvinces() {
		return provinces;
	}

	public void setProvinces(List<ProvinceInfo> provinces) {
		this.provinces = provinces;
	}
	
}
